package com.wangyadong.hobby.schedule.jobtask.classload.chapter6;

import com.wangyadong.hobby.schedule.jobtask.classload.chapter3.MyclassLoad;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * <p>
 *
 * @author <714037465@qq.com>
 * @since 2018/10/3011:02
 **/
public class ThreadContextLoader {

    public static void main(String[] args) throws ClassNotFoundException, SQLException {

        Thread.currentThread().setContextClassLoader(new MyclassLoad());
        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        System.out.println(contextClassLoader);

        Class<?> aClass = Class.forName("com.mysql.jdbc.Driver");

        Class<?> aClass1 = contextClassLoader.loadClass("com.wangyadong.hobby.schedule.jobtask.classload.chapter3.MyclassLoad");
        System.out.println("--->" + aClass1.getClassLoader());

    }
}
